home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / ENET.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  4.9 KB  |  185 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        ENET.h
  3.  
  4.      Contains:    Ethernet Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1990-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __ENET__
  18. #define __ENET__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __OSUTILS__
  25.     #include <OSUtils.h>
  26. #endif
  27.  
  28.  
  29.  
  30.  
  31. #if PRAGMA_ONCE
  32. #pragma once
  33. #endif
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_IMPORT
  40. #pragma import on
  41. #endif
  42.  
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50.  
  51. enum {
  52.     ENetSetGeneral                = 253,                            /*Set "general" mode*/
  53.     ENetGetInfo                    = 252,                            /*Get info*/
  54.     ENetRdCancel                = 251,                            /*Cancel read*/
  55.     ENetRead                    = 250,                            /*Read*/
  56.     ENetWrite                    = 249,                            /*Write*/
  57.     ENetDetachPH                = 248,                            /*Detach protocol handler*/
  58.     ENetAttachPH                = 247,                            /*Attach protocol handler*/
  59.     ENetAddMulti                = 246,                            /*Add a multicast address*/
  60.     ENetDelMulti                = 245                            /*Delete a multicast address*/
  61. };
  62.  
  63. enum {
  64.     EAddrRType                    = FOUR_CHAR_CODE('eadr')        /*Alternate address resource type*/
  65. };
  66.  
  67. typedef struct EParamBlock                 EParamBlock;
  68. typedef EParamBlock *                    EParamBlkPtr;
  69. typedef CALLBACK_API( void , ENETCompletionProcPtr )(EParamBlkPtr thePBPtr);
  70. /*
  71.     WARNING: ENETCompletionProcPtr uses register based parameters under classic 68k
  72.              and cannot be written in a high-level language without 
  73.              the help of mixed mode or assembly glue.
  74. */
  75. typedef REGISTER_UPP_TYPE(ENETCompletionProcPtr)                 ENETCompletionUPP;
  76.  
  77. struct EParamBlock {
  78.     QElem *                            qLink;                        /*General EParams*/
  79.     short                             qType;                        /*queue type*/
  80.     short                             ioTrap;                        /*routine trap*/
  81.     Ptr                             ioCmdAddr;                    /*routine address*/
  82.     ENETCompletionUPP                 ioCompletion;                /*completion routine*/
  83.     OSErr                             ioResult;                    /*result code*/
  84.     StringPtr                         ioNamePtr;                    /*->filename*/
  85.     short                             ioVRefNum;                    /*volume reference or drive number*/
  86.     short                             ioRefNum;                    /*driver reference number*/
  87.     short                             csCode;                        /*Call command code*/
  88.     union {
  89.         struct {
  90.             short                             eProtType;            /*Ethernet protocol type*/
  91.             Ptr                             ePointer;            /*No support for PowerPC code*/
  92.             short                             eBuffSize;            /*buffer size*/
  93.             short                             eDataSize;            /*number of bytes read*/
  94.         }                                 EParms1;
  95.         struct {
  96.             Byte                             eMultiAddr[6];        /*Multicast Address*/
  97.         }                                 EParms2;
  98.     }                                 u;
  99. };
  100.  
  101. #if OPAQUE_UPP_TYPES
  102.     EXTERN_API(ENETCompletionUPP)
  103.     NewENETCompletionUPP           (ENETCompletionProcPtr    userRoutine);
  104.  
  105.     EXTERN_API(void)
  106.     DisposeENETCompletionUPP       (ENETCompletionUPP        userUPP);
  107.  
  108.     EXTERN_API(void)
  109.     InvokeENETCompletionUPP           (EParamBlkPtr            thePBPtr,
  110.                                     ENETCompletionUPP        userUPP);
  111.  
  112. #else
  113.     enum { uppENETCompletionProcInfo = 0x00009802 };                 /* register no_return_value Func(4_bytes:A0) */
  114.     #define NewENETCompletionUPP(userRoutine)                         (ENETCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppENETCompletionProcInfo, GetCurrentArchitecture())
  115.     #define DisposeENETCompletionUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  116.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  117.     #pragma parameter InvokeENETCompletionUPP(__A0, __A1)
  118.     void InvokeENETCompletionUPP(EParamBlkPtr thePBPtr, ENETCompletionUPP userUPP) = 0x4E91;
  119.     #else
  120.         #define InvokeENETCompletionUPP(thePBPtr, userUPP)                 CALL_ONE_PARAMETER_UPP((userUPP), uppENETCompletionProcInfo, (thePBPtr))
  121.     #endif
  122. #endif
  123. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  124. #define NewENETCompletionProc(userRoutine)                         NewENETCompletionUPP(userRoutine)
  125. #define CallENETCompletionProc(userRoutine, thePBPtr)            InvokeENETCompletionUPP(thePBPtr, userRoutine)
  126. EXTERN_API( OSErr )
  127. EWrite                            (EParamBlkPtr             thePBptr,
  128.                                  Boolean                 async);
  129.  
  130. EXTERN_API( OSErr )
  131. EAttachPH                        (EParamBlkPtr             thePBptr,
  132.                                  Boolean                 async);
  133.  
  134. EXTERN_API( OSErr )
  135. EDetachPH                        (EParamBlkPtr             thePBptr,
  136.                                  Boolean                 async);
  137.  
  138. EXTERN_API( OSErr )
  139. ERead                            (EParamBlkPtr             thePBptr,
  140.                                  Boolean                 async);
  141.  
  142. EXTERN_API( OSErr )
  143. ERdCancel                        (EParamBlkPtr             thePBptr,
  144.                                  Boolean                 async);
  145.  
  146. EXTERN_API( OSErr )
  147. EGetInfo                        (EParamBlkPtr             thePBptr,
  148.                                  Boolean                 async);
  149.  
  150. EXTERN_API( OSErr )
  151. ESetGeneral                        (EParamBlkPtr             thePBptr,
  152.                                  Boolean                 async);
  153.  
  154. EXTERN_API( OSErr )
  155. EAddMulti                        (EParamBlkPtr             thePBptr,
  156.                                  Boolean                 async);
  157.  
  158. EXTERN_API( OSErr )
  159. EDelMulti                        (EParamBlkPtr             thePBptr,
  160.                                  Boolean                 async);
  161.  
  162.  
  163.  
  164.  
  165. #if PRAGMA_STRUCT_ALIGN
  166.     #pragma options align=reset
  167. #elif PRAGMA_STRUCT_PACKPUSH
  168.     #pragma pack(pop)
  169. #elif PRAGMA_STRUCT_PACK
  170.     #pragma pack()
  171. #endif
  172.  
  173. #ifdef PRAGMA_IMPORT_OFF
  174. #pragma import off
  175. #elif PRAGMA_IMPORT
  176. #pragma import reset
  177. #endif
  178.  
  179. #ifdef __cplusplus
  180. }
  181. #endif
  182.  
  183. #endif /* __ENET__ */
  184.  
  185.